home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / wndw70.zip / GOOF.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-10  |  3KB  |  85 lines

  1. { ========================================================================== }
  2. { Goof.pas - Displays fatal programming errors            ver 7.0a, 06-10-93 }
  3. {                                                                            }
  4. { This file contains a convenient way to alert you of programming errors     }
  5. { since it is possible to create unseen errors with virtual and hidden       }
  6. { windows.  You can edit and recompile this unit at any time since it is     }
  7. { a circular call.                                                           }
  8. {   Copyright (C) 1993 by James H. LeMay,  All rights reserved.              }
  9. { ========================================================================== }
  10. {$A-,B-,F-,P-,Q-,R-,S-,T-,V-,X+}
  11.  
  12. { Set $D+ in your compiler if you want to see the error messages at run time.}
  13.  
  14. { If undefined, these directives saves data space and some code. }
  15. { If you are using only video page 0, insert a space before the "$": }
  16. {$Define MultiPage }
  17.  
  18. { If you are NOT using virtual windows, insert a space before the "$": }
  19. {$Define AddVirtual }
  20.  
  21.  
  22. UNIT Goof;
  23.  
  24. INTERFACE
  25.  
  26. procedure ShowGoof (ErrorNum: byte);
  27.  
  28.  
  29. IMPLEMENTATION
  30.  
  31. uses
  32.   Qwik, Wndw;
  33.  
  34. procedure ShowGoof; { (ErrorNum: byte); }
  35. type
  36.   Str41 = string[41];
  37. var
  38.   Msg1,Msg2,MemS,MaxS: Str41;
  39. begin
  40. {$ifopt D+ }
  41.   Msg2 := '';
  42.   case ErrorNum of
  43.     1: begin
  44.          Msg1 := 'Not enough Heap space!';
  45.          Str (memavail,MemS);
  46.          Str (maxavail,MaxS);
  47.          Msg2 := 'Mem='+MemS+'/'+'Max='+MaxS;
  48.        end;
  49.     2: Msg1 := 'Too many Windows!';
  50.      {$ifdef AddVirtual }
  51.     3: Msg1 := 'Too many Virtual Windows!';
  52.      {$endif }
  53.     4: Msg1 := 'Perm window out of order!';
  54.     5: Msg1 := 'No window to remove!';
  55.     6: Msg1 := 'Hidden window not found!';
  56.      {$ifdef AddVirtual }
  57.     7: Msg1 := 'Virtual screen not found!';
  58.      {$endif }
  59.      {$ifdef MultiPage }
  60.     8: Msg1 := 'Video page not available!';
  61.      {$endif }
  62.   end;
  63. {$endif }
  64.   TopWndwStat := WndwStat[0];   { Get original CRT stat }
  65.   QScrRec := TWS.VScrRec;       { Set Qwik stats }
  66.    {$ifdef MultiPage }
  67.   QwritePage (0);               { Ensure we are writing to page 0 }
  68.   QviewPage (0);                { Ensure we are viewing page 0 }
  69.    {$endif }
  70.   LI  := 0;                     { Set top window level }
  71.   HLI := 2;                     { Prevent index conflict }
  72.   WindowModes := RelMode;
  73.   MakeWindow (0,0,5,42,LightGrayBG,LightGrayBG+Blink,DoubleBrdr,aWindow);
  74. {$ifopt D+ }
  75.   WWriteC (1,Msg1);
  76.   WWriteC (2,Msg2);
  77. {$endif }
  78.   WWriteC (3,'Program halted.');
  79.   GotoRC (CrtRows-1,1);
  80.   SetCursor (CursorInitial);
  81.   Halt;
  82. end;
  83.  
  84. END.
  85.